package com.sleep.psy.external_server.business.sys.controller;


import com.alibaba.fastjson.JSON;
import com.sleep.psy.external_server.business.adjustment.controller.AdjustmentPlanDetailsController;
import com.sleep.psy.external_server.business.evaluation.entity.sleep.ReportReq;
import com.sleep.psy.external_server.business.sys.entity.SysModule;
import com.sleep.psy.external_server.business.sys.service.SysModuleService;
import com.sleep.psy.external_server.result.Result;
import com.sleep.psy.external_server.result.ResultEnum;
import com.sleep.psy.external_server.result.ResultUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;
import java.util.List;

/**
 * <p>
 * App底栏配置表 前端控制器
 * </p>
 *
 * @author wenliguo
 * @since 2025-08-20
 */
@Api(tags = "底栏配置")
@RestController
@RequestMapping("/sysModule")
public class SysModuleController {

    protected Logger logger = LoggerFactory.getLogger(SysModuleController.class);

    @Autowired
    private SysModuleService moduleService;

    /**
     * 获取底栏配置
     * @author wenliguo
     * @date 2025/8/20 10:54
     * @return com.sleep.psy.external_server.result.Result<java.util.List<com.sleep.psy.external_server.business.sys.entity.SysModule>>
    */
    @GetMapping("/selectModule")
    @ApiOperation(value = "获取底栏配置")
    public Result<List<SysModule>> selectModule() {

        try {
            return moduleService.selectModule();
        } catch (Exception e) {
            logger.error("获取底栏配置出错", e);
            return ResultUtil.error(ResultEnum.SERVER_INTERNAL_ERROR);
        }
    }
}

